

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>activate &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="scan" href="../scan/" />
    <link rel="prev" title="simple" href="../" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../">ceph-volume</a> &raquo;</li>
        
      <li><code class="docutils literal notranslate"><span class="pre">activate</span></code></li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/ceph-volume/simple/activate.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">ceph-volume</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../../#id2">迁移</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../../#id3">全新部署</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../../#osd">已有 OSD 怎么办</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../../intro/">Overview</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#replacing-ceph-disk">Replacing <code class="docutils literal notranslate"><span class="pre">ceph-disk</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#gpt-partitions-are-simple">GPT partitions are simple?</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#modularity">Modularity</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#ceph-volume-lvm"><code class="docutils literal notranslate"><span class="pre">ceph-volume</span> <span class="pre">lvm</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#lvm-performance-penalty">LVM performance penalty</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../inventory/"><code class="docutils literal notranslate"><span class="pre">inventory</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../drive-group/"><code class="docutils literal notranslate"><span class="pre">drive-group</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/"><code class="docutils literal notranslate"><span class="pre">lvm</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/activate/"><code class="docutils literal notranslate"><span class="pre">activate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/batch/"><code class="docutils literal notranslate"><span class="pre">batch</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/batch/#ceph-volume-lvm-batch-report">报表</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/batch/#sizing">Sizing</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/batch/#idempotency-and-disk-replacements">Idempotency and disk replacements</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/encryption/">加密</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/prepare/"><code class="docutils literal notranslate"><span class="pre">prepare</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/create/"><code class="docutils literal notranslate"><span class="pre">create</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/scan/">scan</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/list/"><code class="docutils literal notranslate"><span class="pre">list</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/zap/"><code class="docutils literal notranslate"><span class="pre">zap</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/migrate/"><code class="docutils literal notranslate"><span class="pre">migrate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/newdb/"><code class="docutils literal notranslate"><span class="pre">new-db</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../lvm/newwal/"><code class="docutils literal notranslate"><span class="pre">new-wal</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../"><code class="docutils literal notranslate"><span class="pre">simple</span></code></a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">activate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../scan/"><code class="docutils literal notranslate"><span class="pre">scan</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../zfs/"><code class="docutils literal notranslate"><span class="pre">zfs</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../zfs/inventory/"><code class="docutils literal notranslate"><span class="pre">inventory</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="activate">
<span id="ceph-volume-simple-activate"></span><h1><code class="docutils literal notranslate"><span class="pre">activate</span></code><a class="headerlink" href="#activate" title="Permalink to this headline">¶</a></h1>
<p>Once <a class="reference internal" href="../scan/#ceph-volume-simple-scan"><span class="std std-ref">scan</span></a> has been completed, and all the metadata
captured for an OSD has been persisted to <code class="docutils literal notranslate"><span class="pre">/etc/ceph/osd/{id}-{uuid}.json</span></code>
the OSD is now ready to get “activated”.</p>
<p>This activation process <strong>disables</strong> all <code class="docutils literal notranslate"><span class="pre">ceph-disk</span></code> systemd units by masking
them, to prevent the UDEV/ceph-disk interaction that will attempt to start them
up at boot time.</p>
<p>The disabling of <code class="docutils literal notranslate"><span class="pre">ceph-disk</span></code> units is done only when calling <code class="docutils literal notranslate"><span class="pre">ceph-volume</span>
<span class="pre">simple</span> <span class="pre">activate</span></code> directly, but is is avoided when being called by systemd when
the system is booting up.</p>
<p>The activation process requires using both the <a class="reference internal" href="../../../glossary/#term-OSD-id"><span class="xref std std-term">OSD id</span></a> and <a class="reference internal" href="../../../glossary/#term-OSD-uuid"><span class="xref std std-term">OSD uuid</span></a>
To activate parsed OSDs:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">volume</span> <span class="n">simple</span> <span class="n">activate</span> <span class="mi">0</span> <span class="mi">6</span><span class="n">cc43680</span><span class="o">-</span><span class="mi">4</span><span class="n">f6e</span><span class="o">-</span><span class="mi">4</span><span class="n">feb</span><span class="o">-</span><span class="mi">92</span><span class="n">ff</span><span class="o">-</span><span class="mi">9</span><span class="n">c7ba204120e</span>
</pre></div>
</div>
<p>The above command will assume that a JSON configuration will be found in:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">osd</span><span class="o">/</span><span class="mi">0</span><span class="o">-</span><span class="mi">6</span><span class="n">cc43680</span><span class="o">-</span><span class="mi">4</span><span class="n">f6e</span><span class="o">-</span><span class="mi">4</span><span class="n">feb</span><span class="o">-</span><span class="mi">92</span><span class="n">ff</span><span class="o">-</span><span class="mi">9</span><span class="n">c7ba204120e</span><span class="o">.</span><span class="n">json</span>
</pre></div>
</div>
<p>Alternatively, using a path to a JSON file directly is also possible:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">volume</span> <span class="n">simple</span> <span class="n">activate</span> <span class="o">--</span><span class="n">file</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">osd</span><span class="o">/</span><span class="mi">0</span><span class="o">-</span><span class="mi">6</span><span class="n">cc43680</span><span class="o">-</span><span class="mi">4</span><span class="n">f6e</span><span class="o">-</span><span class="mi">4</span><span class="n">feb</span><span class="o">-</span><span class="mi">92</span><span class="n">ff</span><span class="o">-</span><span class="mi">9</span><span class="n">c7ba204120e</span><span class="o">.</span><span class="n">json</span>
</pre></div>
</div>
<div class="section" id="requiring-uuids">
<h2>requiring uuids<a class="headerlink" href="#requiring-uuids" title="Permalink to this headline">¶</a></h2>
<p>The <a class="reference internal" href="../../../glossary/#term-OSD-uuid"><span class="xref std std-term">OSD uuid</span></a> is being required as an extra step to ensure that the
right OSD is being activated. It is entirely possible that a previous OSD with
the same id exists and would end up activating the incorrect one.</p>
<div class="section" id="discovery">
<h3>Discovery<a class="headerlink" href="#discovery" title="Permalink to this headline">¶</a></h3>
<p>With OSDs previously scanned by <code class="docutils literal notranslate"><span class="pre">ceph-volume</span></code>, a <em>discovery</em> process is
performed using <code class="docutils literal notranslate"><span class="pre">blkid</span></code> and <code class="docutils literal notranslate"><span class="pre">lvm</span></code>. There is currently support only for
devices with GPT partitions and LVM logical volumes.</p>
<p>The GPT partitions will have a <code class="docutils literal notranslate"><span class="pre">PARTUUID</span></code> that can be queried by calling out
to <code class="docutils literal notranslate"><span class="pre">blkid</span></code>, and the logical volumes will have a <code class="docutils literal notranslate"><span class="pre">lv_uuid</span></code> that can be
queried against <code class="docutils literal notranslate"><span class="pre">lvs</span></code> (the LVM tool to list logical volumes).</p>
<p>This discovery process ensures that devices can be correctly detected even if
they are repurposed into another system or if their name changes (as in the
case of non-persisting names like <code class="docutils literal notranslate"><span class="pre">/dev/sda1</span></code>)</p>
<p>The JSON configuration file used to map what devices go to what OSD will then
coordinate the mounting and symlinking as part of activation.</p>
<p>To ensure that the symlinks are always correct, if they exist in the OSD
directory, the symlinks will be re-done.</p>
<p>A systemd unit will capture the <a class="reference internal" href="../../../glossary/#term-OSD-id"><span class="xref std std-term">OSD id</span></a> and <a class="reference internal" href="../../../glossary/#term-OSD-uuid"><span class="xref std std-term">OSD uuid</span></a> and
persist it. Internally, the activation will enable it like:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>systemctl enable ceph-volume@simple-$id-$uuid
</pre></div>
</div>
<p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">systemctl</span> <span class="n">enable</span> <span class="n">ceph</span><span class="o">-</span><span class="n">volume</span><span class="nd">@simple</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">8715</span><span class="n">BEB4</span><span class="o">-</span><span class="mi">15</span><span class="n">C5</span><span class="o">-</span><span class="mi">49</span><span class="n">DE</span><span class="o">-</span><span class="n">BA6F</span><span class="o">-</span><span class="mi">401086</span><span class="n">EC7B41</span>
</pre></div>
</div>
<p>Would start the discovery process for the OSD with an id of <code class="docutils literal notranslate"><span class="pre">0</span></code> and a UUID of
<code class="docutils literal notranslate"><span class="pre">8715BEB4-15C5-49DE-BA6F-401086EC7B41</span></code>.</p>
<p>The systemd process will call out to activate passing the information needed to
identify the OSD and its devices, and it will proceed to:</p>
<dl class="simple">
<dt># mount the device in the corresponding location (by convention this is</dt><dd><p><code class="docutils literal notranslate"><span class="pre">/var/lib/ceph/osd/&lt;cluster</span> <span class="pre">name&gt;-&lt;osd</span> <span class="pre">id&gt;/</span></code>)</p>
</dd>
</dl>
<p># ensure that all required devices are ready for that OSD and properly linked,
regardless of objectstore used (filestore or bluestore). The symbolic link will
<strong>always</strong> be re-done to ensure that the correct device is linked.</p>
<p># start the <code class="docutils literal notranslate"><span class="pre">ceph-osd&#64;0</span></code> systemd unit</p>
</div>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../scan/" class="btn btn-neutral float-right" title="scan" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../" class="btn btn-neutral float-left" title="simple" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>